<template>
	<view class="main">
		<view class="dev-box">
			<textarea v-model="schoolSquare.msg" type="text" maxlength="500" placeholder="这一刻的想法..."></textarea>
			<m-upimg count="9" url="https://www.cscmkj.cn/starCityAll/user/saveImg" :notli="true" @onUpImg="onUpImg()"></m-upimg>
		</view>
		<view class="address">
		  <u-icon name="map-fill" class="map-icon" color="#2979ff"></u-icon>
		  <span color="#2979ff">永州职业技术学院</span>
		</view>
		<button class="submitBtn" @click="submit" >立即发布</button>
	</view>
</template>

<script>
	import config from "@/config/index.config.js";
	import mUpimg from '@/components/m-upimg/m-upimg.1.vue'; //input
	export default {
		components: {
			mUpimg
		},
		data() {
			return {
				schoolSquare:{
					msg:"",
					url:""
				}
			}
		},
		onLoad() {
		},
		methods: {
			onUpImg(pList){
				console.log(pList)
				this.schoolSquare.url=""
				for(var l in pList){
					this.schoolSquare.url+=pList[l].path_server+",";
				}
				this.schoolSquare.url=this.schoolSquare.url.substring(0,this.schoolSquare.url.length-1)
			},
			submit(){
				var that  = this;
				uni.request({
					url: `${config.baseUrl}/starCityAll/circle/circleSave`,
					method: "POST",
					data: this.schoolSquare,
					dataType: "json",
					header: {
						"content-type": "application/json",
						"Blade-Auth":uni.getStorageSync("token")
					},
					success: (res) => {
						if(res.data.code==0){
							uni.showToast({
							  title:  "发布成功！",
							  icon: 'success',
							  complete:(res) => {
								  uni.reLaunch({
								  	url:"/pages/index/index"
								  })
							  }
							});
							
						}
					}
				
				})
			}
		
		}
	}
</script>

<style lang="scss">
::-webkit-scrollbar{
	display: none;
}
.address {
      margin-left: 20rpx;
      margin-top: 20rpx;
	  display:flex;
      .map-icon {
        margin-right: 10rpx;
      }
    }
.dev-box{
		margin-top: 16rpx;
		padding: 32rpx;
	}
	.submitBtn{
		margin: 40upx 4% 20upx 4%;
		width:92%;
		height:80upx;
		line-height: 80upx;
		color:white;
		border-radius: 35upx;
		background-color: #5FDB7E;
	}
</style>
